package com.example;

import com.example.dao.UserDao;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class UserApp {
    //1.实例工厂
    @Test
    public void test(){
        ClassPathXmlApplicationContext Context=new ClassPathXmlApplicationContext("applicationContext.xml");
        UserDao userDao = (UserDao) Context.getBean("userDao");
        userDao.save();
        Context.registerShutdownHook();
    }

    //1.集合注入
    @Test
    public void test1(){
        ClassPathXmlApplicationContext Context=new ClassPathXmlApplicationContext("applicationContext.xml");
        UserDao userDao = (UserDao) Context.getBean("userDao1");
        userDao.save();
        Context.registerShutdownHook();
    }
}
